package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.CategoryPageQueryDTO;
import com.sky.entity.Category;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface CategoryMapper {

    @AutoFill(value = OperationType.UPDATE)
    void update(Category category);

    Page<Category> getPage(CategoryPageQueryDTO dto);

    @AutoFill(value = OperationType.UPDATE)
    @Update("update category set status = #{status}, update_time = #{updateTime}, update_user = #{updateUser} where id = #{id}")
    void updateStatus(Category category);

    @AutoFill(value = OperationType.INSERT)
    void insert(Category category);

    Page<Category> getCondition(CategoryPageQueryDTO dto);

    @Delete("delete from category where id = #{id}")
    void delete(Long id);

    List<Category> getByType(Integer type);

}















